package com.css.apps.base.role.action;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.css.apps.base.common.provider.json.OrgJsonProvider;
import com.css.apps.base.role.model.SRole;
import com.css.core.configuration.Environment;
import com.css.db.query.QueryCache;
import com.css.util.Ajax;
import com.css.util.Messages;
import com.css.util.StringHelper;
import com.css.webbase.webwork.action.AdminAction;
import com.opensymphony.xwork.Action;

@SuppressWarnings("serial")
public class GetRoleUser extends AdminAction {
	
	private static Log log = LogFactory.getLog(GetRoleUser.class);
	private String roleId;
	private SRole item;
	private String orgId;
	private String tree;
	private boolean Flag;

	@Override
	protected String adminGo() {
		try {
			if (StringHelper.isNotEmpty(roleId)) {
				item = QueryCache.get(SRole.class, roleId);
			}
			// if(Flag == false){
			// setMessage(Messages.getString("systemMsg.NoAddUserRole"));
			// return Action.ERROR;
			// }
			OrgJsonProvider json = new OrgJsonProvider();
			tree = json.getOrgRadio(null).toString();
			return Action.SUCCESS;
		} catch (Exception ex) {
			result = Ajax.JSONResult(Environment.RESULT_CODE_ERROR, Messages.getString("systemMsg.exception"));
			log.error(ex.getMessage(), ex);
			return Action.ERROR;
		}

	}

	public String getRoleId() {
		return roleId;
	}

	public void setRoleId(String roleId) {
		this.roleId = roleId;
	}

	public SRole getItem() {
		return item;
	}

	public void setItem(SRole item) {
		this.item = item;
	}

	public boolean isFlag() {
		return Flag;
	}

	public void setFlag(boolean flag) {
		Flag = flag;
	}

	public String getOrgId() {
		return orgId;
	}

	public void setOrgId(String orgId) {
		this.orgId = orgId;
	}

	public String getTree() {
		return tree;
	}

	public void setTree(String tree) {
		this.tree = tree;
	}

}
